const Model = require("../models/{{table['camel']}}");
const {info, remove, save, update, list, page} = require("../utils/controllerUtils")

exports.info = async (req, res) => {
  info(Model, req.params.id, res)
};


exports.remove = async (req, res) => {
  remove(Model, req.params.id, res)
};


exports.save = async (req, res) => {
  try {
    let body = req.body;
    save(Model, body, res);
  } catch (error) {
    console.error(error);
    res.json({ code: 500, msg: "server error." });
  }
};

exports.update = async (req, res) => {
  try {
    let body = req.body;
    body['update_time'] = new Date();
    update(Model, body, res);
  } catch (error) {
    console.error(error);
    res.json({ code: 500, msg: "server error." });
  }
};

exports.list = async (req, res) => {
  list(Model, req.body, res);
};

exports.page = async (req, res) => {
  page(Model, req.body, res);
};


